import request from '@/utils/request'

export function getInfo(query) {
  return request({
    url: '/project/page',
    method: 'get',
    params: query
  })
}

export function add(data) {
  return request({
    url: '/project',
    method: 'post',
    data
  })
}

export function update(id, data) {
  return request({
    url: `/project/${id}`,
    method: 'put',
    data
  })
}

export function cancel(id) {
  return request({
    url: `/project/cancel/${id}`,
    method: 'put'
  })
}

export function recovery(id) {
  return request({
    url: `/project/recovery/${id}`,
    method: 'put'
  })
}

export function open(id) {
  return request({
    url: `/project/open/${id}`,
    method: 'put'
  })
}

export function close(id) {
  return request({
    url: `/project/close/${id}`,
    method: 'put'
  })
}

export function getFileInfo(projectId) {
  return request({
    url: `/project/file/${projectId}`,
    method: 'get'
  })
}
export function getFileInfo1(projectId, params) {
  return request({
    url: `/project/file/${projectId}`,
    method: 'get',
    params: params
  })
}
export function uploadFile(id, file) {
  return request({
    url: `/project/uploadFile/${id}`,
    method: 'post',
    data: file
  })
}

export function uploadFileCancel(id) {
  return request({
    url: `/project/uploadFile/cancel/${id}`,
    method: 'put'
  })
}

export function supplier(data) {
  return request({
    url: `/project/supplier/add`,
    method: 'post',
    data: data
  })
}

export function supplierDel(id) {
  return request({
    url: `/project/supplier/del/${id}`,
    method: 'delete'
  })
}

export function getSupplierInfo(id) {
  return request({
    url: `/project/supplier/${id}`,
    method: 'get'
  })
}

export function getUserInfoByLeader(id) {
  return request({
    url: `/project/user/leader/${id}`,
    method: 'get'
  })
}

export function Member(id) {
  return request({
    url: `/project/user/member/${id}`,
    method: 'get'
  })
}
export function getUserInfoByMember(data) {
  return request({
    url: `/sysfunction/check/getFunctionCheckUserList/`,
    method: 'get',
    params: data
  })
}

export function user(data) {
  return request({
    url: `/project/user/add`,
    method: 'post',
    data: data
  })
}

export function userDel(id) {
  return request({
    url: `/project/user/del/${id}`,
    method: 'delete'
  })
}

export function downFile(id) {
  return request({
    url: `/project/downloadFile/${id}`,
    method: 'get'
  })
}
// 添加询价项目
export function addInquiry(data) {
  return request({
    url: '/project/askPrice/',
    method: 'post',
    data
  })
}
// 添加
export function addaskPrice(data) {
  return request({
    url: '/project/material/',
    method: 'post',
    data
  })
}
export function getaskPrice(id) {
  return request({
    url: `/project/askPrice/material/${id}`,
    method: 'get'
  })
}
export function getBiddingPrice(id) {
  return request({
    url: `/project/givePrice/material/${id}`,
    method: 'get'
  })
}
export function delaskPrice(id) {
  return request({
    url: `/project/material/del/${id}`,
    method: 'delete'
  })
}
export function getMaterial() {
  return request({
    url: '/project/material/',
    method: 'get'
  })
}
export function editMaterial(id, data) {
  return request({
    url: `/project/askPrice/${id}`,
    method: 'put',
    data
  })
}
export function givePrice(id, data) {
  return request({
    url: `project/givePrice/${id}`,
    method: 'POST',
    data
  })
}
export function matericalall(id) {
  return request({
    url: `/project/givePrice/all/${id}`,
    method: 'get'
  })
}
export function impOrder(id, file) {
  return request({
    url: `/project/impMaterialData/${id}`,
    method: 'post',
    data: file
  })
}
export function getModel() {
  return request({
    url: `/project/downloadModel`,
    method: 'get',
    responseType: 'arraybuffer'
  })
}

export function getFileInfofu(data) {
  return request({
    url: '/project/materialInquiryFileInfo',
    method: 'get',
    params: data
  })
}

export function downLoadContarctFile(materialInquiryId) {
  return request({
    url: `/scm/materialInquiry/downloadFile/${materialInquiryId}`,
    method: 'get',
    responseType: 'arraybuffer'
  })
}
